﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace SelfService.DataAccess.Migrations
{
    public partial class 硬件管理新增压缩文件支持 : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<Guid>(
                name: "DllZipId",
                table: "SysDevices",
                type: "char(36)",
                nullable: true,
                collation: "ascii_general_ci");

            migrationBuilder.UpdateData(
                table: "SysClientsLog",
                keyColumn: "Module",
                keyValue: null,
                column: "Module",
                value: "");

            migrationBuilder.AlterColumn<string>(
                name: "Module",
                table: "SysClientsLog",
                type: "varchar(64)",
                maxLength: 64,
                nullable: false,
                oldClrType: typeof(string),
                oldType: "longtext",
                oldNullable: true)
                .Annotation("MySql:CharSet", "utf8mb4")
                .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.UpdateData(
                table: "SysClientsLog",
                keyColumn: "Info",
                keyValue: null,
                column: "Info",
                value: "");

            migrationBuilder.AlterColumn<string>(
                name: "Info",
                table: "SysClientsLog",
                type: "longtext",
                nullable: false,
                oldClrType: typeof(string),
                oldType: "longtext",
                oldNullable: true)
                .Annotation("MySql:CharSet", "utf8mb4")
                .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateIndex(
                name: "IX_SysDevices_DllZipId",
                table: "SysDevices",
                column: "DllZipId");

            migrationBuilder.AddForeignKey(
                name: "FK_SysDevices_FileAttachments_DllZipId",
                table: "SysDevices",
                column: "DllZipId",
                principalTable: "FileAttachments",
                principalColumn: "ID",
                onDelete: ReferentialAction.Restrict);
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_SysDevices_FileAttachments_DllZipId",
                table: "SysDevices");

            migrationBuilder.DropIndex(
                name: "IX_SysDevices_DllZipId",
                table: "SysDevices");

            migrationBuilder.DropColumn(
                name: "DllZipId",
                table: "SysDevices");

            migrationBuilder.AlterColumn<string>(
                name: "Module",
                table: "SysClientsLog",
                type: "longtext",
                nullable: true,
                oldClrType: typeof(string),
                oldType: "varchar(64)",
                oldMaxLength: 64)
                .Annotation("MySql:CharSet", "utf8mb4")
                .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterColumn<string>(
                name: "Info",
                table: "SysClientsLog",
                type: "longtext",
                nullable: true,
                oldClrType: typeof(string),
                oldType: "longtext")
                .Annotation("MySql:CharSet", "utf8mb4")
                .OldAnnotation("MySql:CharSet", "utf8mb4");
        }
    }
}
